package com.HW.Search;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @ClassName : TJuZhenBound
 * @Author : kele
 * @Date: 2023/11/1 23:10
 * @Description :
 */
public class TJuZhenBound {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        Integer[][] array = Arrays.stream(str.substring(2, str.length() - 2).split("],\\[")).map(x -> {
            return Arrays.stream(x.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
        }).toArray(Integer[][]::new);
        handle(array);


    }

    public static void handle(Integer[][] array) {

        int min = Integer.MAX_VALUE;



        int x = array.length;
        int y = array[0].length;

        for (int i = 0; i < y; i++) {
            int max = Integer.MIN_VALUE;
            for (int j = 0; j < x; j++) {
                max = Math.max(max, array[j][i]);
            }
            min = Math.min(min, max);
        }
        System.out.println(min);
    }
}
